We can also prefer to keep the parent function intact in the child
contract, as shown as follows:
// SPDX-License-Identifier: SOME IDENTIFIER
pragma solidity ^0.8.10;
contract Mammal {
function mammalFunction() public pure returns(string memory)
{
return “Mammals produce offsprings by directly giving
birth and females have mammary glands”;
}
}
contract SpecialAnimal is Mammal {
function specialFunction() public view returns(string
memory) {
this.mammalFunction();
return “Special mammals can walk with two legs “;
}
}
Solidity also supports multiple inheritance, as shown in the following
code example:
// SPDX-License-Identifier: SOME IDENTIFIER
pragma solidity ^0.8.10;
contract Mammal {
function mammalFunction() public pure returns(string memory)
{
return “Mammals produce offsprings by directly giving
birth and females have mammary glands”;
}
}
contract Bird {
function birdFunction() public pure returns(string memory) {